/*8f92WYTvNvqLOa023aQCKVl44Hrces+mhsIXRN0Zhpe6JAbTw0iAHrZezi0kzN06*/
/*
 * @Author: xiahui 
 * @PageInfo: 列表态按钮状态控制
 * @Date: 2019-02-28 20:42:41 
 * @Last Modified by: xiahui
 * @Last Modified time: 2019-03-19 10:29:23
 */
import { AREA, UISTATUS, BUTTONID } from '../../constance';

function buttonControl(props, status, checkArr) {
	initButtonAndTableStatus.call(this, props, status);

	let disabled = !checkArr || checkArr == 0;
	props.button.setButtonDisabled(
		[ BUTTONID.GenPayreq, BUTTONID.Payment, BUTTONID.QueryAboutBusiness, BUTTONID.Delete ],
		disabled
	);
}

/**
 * 设置按钮和表格初始状态
 * @param {*} props 
 */
function initButtonAndTableStatus(props, status) {
	props.button.setButtonVisible(
		[
			BUTTONID.Edit,
			BUTTONID.GenPayreq,
			BUTTONID.Payment,
			BUTTONID.QueryAboutBusiness,
			BUTTONID.Print,
			BUTTONID.Refresh
		],
		status == UISTATUS.browse
	);

	props.button.setButtonVisible(
		[
			BUTTONID.Save,
			BUTTONID.Cancel,
			BUTTONID.Add,
			BUTTONID.Delete,
			BUTTONID.InsertLine,
			BUTTONID.DeleteLine,
			BUTTONID.CopyLine
		],
		status == UISTATUS.edit
	);

	props.editTable.setStatus(AREA.listTableId, status);
}
export { buttonControl };

/*8f92WYTvNvqLOa023aQCKVl44Hrces+mhsIXRN0Zhpe6JAbTw0iAHrZezi0kzN06*/